package cn.iocoder.yudao.module.wms.dal.mysql.inventoryclassify;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.wms.controller.admin.inventoryclassify.vo.InventoryClassifyPageReqVO;
import cn.iocoder.yudao.module.wms.dal.dataobject.inventoryclassify.InventoryClassifyDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.Collection;

/**
 * 存货分类 Mapper
 *
 * @author 曾劲松
 */
@Mapper
public interface InventoryClassifyMapper extends BaseMapperX<InventoryClassifyDO> {

    default PageResult<InventoryClassifyDO> selectPage(InventoryClassifyPageReqVO reqVO, Collection<Long> parentIds) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InventoryClassifyDO>()
                .likeIfPresent(InventoryClassifyDO::getCode, reqVO.getCode())
                .likeIfPresent(InventoryClassifyDO::getName, reqVO.getName())
                .inIfPresent(InventoryClassifyDO::getParentId, parentIds)
                .betweenIfPresent(InventoryClassifyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InventoryClassifyDO::getId));
    }
}